<template>
  <a v-if="outUri(item.url)" :href="item.url" target="_blank">
    <el-image style="width: 100%; height: 100%" :src="item.coverimgurl" fit="cover"></el-image>
  </a>
  <router-link v-else-if="item.url" :to="item.url" target="_self">
    <el-image style="width: 100%; height: 100%" :src="item.coverimgurl" fit="cover"></el-image>
  </router-link>
  <el-image v-else style="width: 100%; height: 100%" :src="item.coverimgurl" fit="cover"></el-image>
</template>

<script setup name="bannerImage">
const props = defineProps({
  item: {
    type: Object,
    default: () => ({})
  }
})
const outUri = (url) => {
  return url ? url.startsWith('http') : false
}
</script>

<style lang="scss" scoped></style>